class Admin::HomeController < ApplicationController
  before_filter :check_admin_authorization,:except => ["index"]
  layout :my_layout
  def my_layout
    if @action_name == "index"
      "login"
    else
      "admin"
    end
  end
  def index
    if session[:admin]
     redirect_to '/admin/home/dashboard'
    end
    if request.post?                             
      if params[:user][:username] == "sunni" and params[:user][:password] == "ilovesunni"
        session[:admin] = "login" 
        redirect_to '/admin/company'
      else
        redirect_to '/admin/home'
      end
    end
  end
  def dashboard
  end
  def logout
    session[:admin] = nil
    redirect_to '/admin/'
  end
end
